import execjs


class JavaScriptExecutor(object):
    def __init__(self, js_file_path):
        with open(js_file_path) as js_file:
            self.js_code = js_file.read()
        self.context = execjs.compile(self.js_code)

    @staticmethod
    def execute_js(js_code, function_name, *args):
        try:
            context = execjs.compile(js_code)
            return context.call(function_name, *args)
        except execjs.RuntimeError as e:
            print(f"JavaScript Runtime Error: {e}")
            return None

    def execute_function(self, function_name, *args):
        try:
            result = self.context.call(function_name, *args)
            return result
        except execjs.RuntimeError as e:
            print(f"JavaScript Runtime Error: {e}")
            return None

if __name__ == "__main__":
    add_result = JavaScriptExecutor.execute_js("function add(x, y){return x+y;}", "add", 3, 4)
    print(add_result)